package com.liang.security.springmvc.init;

import com.liang.security.springmvc.config.ApplicationConfig;
import com.liang.security.springmvc.config.WebConfig;
import com.liang.security.springmvc.config.WebSecurityConfig;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;

/**
 * @author liang zai
 * @date 2021/8/31 14:58
 * @description 加载spring容器
 */
public class SpringApplicationInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {

    //指定rootContext的配置类
    @Override
    protected Class<?>[] getRootConfigClasses() {
        return new Class<?>[]{ApplicationConfig.class, WebSecurityConfig.class};
    }

    //指定servletContext的配置类
    @Override
    protected Class<?>[] getServletConfigClasses() {
        return new Class<?>[]{WebConfig.class};
    }

    @Override
    protected String[] getServletMappings() {
        return new String[]{"/"};
    }
}
